<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserAddressesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_addresses', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('customer_id')->comment('顾客 ID');
            $table->integer('province_id')->comment('省');
            $table->integer('city_id')->comment('市');
            $table->integer('district_id')->comment('县/区');
            $table->text('address')->comment('详细地址');
            $table->string('contact_name')->comment('联系人名称');
            $table->string('contact_phone')->comment('联系电话');
            $table->unsignedInteger('zip')->nullable()->comment('邮编');
            $table->boolean('is_default')->default(0)->comment('是否默认');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_addresses');
    }
}
